<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\Admin\models\PhotoSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '轮播图管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="photo-index panel panel-body">

    <p>
        <?= Html::a('创建轮播图', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?php Pjax::begin(); ?>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            //'url:url',
			[
				'attribute'=> 'url',
				'format' => [
					'image',['width'=>200,'height'=>100]
				]
			],
            'name',
            [
			'attribute' => 'status',
			'value' => function($model){
				$status  = [1=>'正常', 2=>'禁用'];
				return empty($model->status) ? '-' :  $status[$model->status]; 
			},
			'filter' => [1=>'正常', 2=>'禁用'],
			],

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

    <?php Pjax::end(); ?>

</div>
